﻿using System;
namespace Producers.Liiklusregister.Xtee.Riik.Ee.Producer.Liiklusregister {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="paring2_soidukiandmed", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring2Soidukiandmed))]
    public class Paring2SoidukiandmedSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IParing2Soidukiandmed clazz;
        
        public Paring2SoidukiandmedSerializer(IParing2Soidukiandmed clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("regmrk");
            if (clazz.Regmrk!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Regmrk))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("nr_tyyp");
            if (clazz.NrTyyp!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.NrTyyp))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtun");
            if (clazz.Regtun!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Regtun))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtun_kuup");
            if (clazz.RegtunKuup!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegtunKuup))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kehtiv");
            if (clazz.Kehtiv!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kehtiv))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtulek");
            if (clazz.Regtulek!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Regtulek))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtun_valjastaja");
            if (clazz.RegtunValjastaja!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegtunValjastaja))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("idkood");
            if (clazz.Idkood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Idkood))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("vinkood");
            if (clazz.Vinkood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Vinkood))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("soiduki_andmed");
            if (clazz.SoidukiAndmed!=null) {
                global::Xtee.Core.SerializationMetadata metaSoidukiAndmed = this.GetMetaData(clazz.SoidukiAndmed);
                Writer.WriteTypeAttribute(metaSoidukiAndmed.TypeQualifiedName.Namespace, metaSoidukiAndmed.TypeQualifiedName.Name);
                metaSoidukiAndmed.NewSerializer(clazz.SoidukiAndmed).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SoidukiAndmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("piirang");
            if (clazz.Piirang!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Piirang))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("oma_andmed_v");
            if (clazz.OmaAndmedV!=null) {
                global::Xtee.Core.SerializationMetadata metaOmaAndmedV = this.GetMetaData(clazz.OmaAndmedV);
                Writer.WriteTypeAttribute(metaOmaAndmedV.TypeQualifiedName.Namespace, metaOmaAndmedV.TypeQualifiedName.Name);
                metaOmaAndmedV.NewSerializer(clazz.OmaAndmedV).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OmaAndmedV");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("hooldaja");
            if (clazz.Hooldaja!=null) {
                global::Xtee.Core.SerializationMetadata metaHooldaja = this.GetMetaData(clazz.Hooldaja);
                Writer.WriteTypeAttribute(metaHooldaja.TypeQualifiedName.Namespace, metaHooldaja.TypeQualifiedName.Name);
                metaHooldaja.NewSerializer(clazz.Hooldaja).WriteXml(Writer);
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kasutajad");
            if (clazz.Kasutajad!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kasutajad))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
        START:
            if ((Reader.LocalName == "regmrk")) {
                goto regmrk;
            }
            else {
                if ((Reader.LocalName == "nr_tyyp")) {
                    goto nr_tyyp;
                }
                else {
                    if ((Reader.LocalName == "regtun")) {
                        goto regtun;
                    }
                    else {
                        if ((Reader.LocalName == "regtun_kuup")) {
                            goto regtun_kuup;
                        }
                        else {
                            if ((Reader.LocalName == "kehtiv")) {
                                goto kehtiv;
                            }
                            else {
                                if ((Reader.LocalName == "regtulek")) {
                                    goto regtulek;
                                }
                                else {
                                    if ((Reader.LocalName == "regtun_valjastaja")) {
                                        goto regtun_valjastaja;
                                    }
                                    else {
                                        if ((Reader.LocalName == "idkood")) {
                                            goto idkood;
                                        }
                                        else {
                                            if ((Reader.LocalName == "vinkood")) {
                                                goto vinkood;
                                            }
                                            else {
                                                if ((Reader.LocalName == "soiduki_andmed")) {
                                                    goto soiduki_andmed;
                                                }
                                                else {
                                                    if ((Reader.LocalName == "piirang")) {
                                                        goto piirang;
                                                    }
                                                    else {
                                                        if ((Reader.LocalName == "oma_andmed_v")) {
                                                            goto oma_andmed_v;
                                                        }
                                                        else {
                                                            if ((Reader.LocalName == "hooldaja")) {
                                                                goto hooldaja;
                                                            }
                                                            else {
                                                                if ((Reader.LocalName == "kasutajad")) {
                                                                    goto kasutajad;
                                                                }
                                                                else {
                                                                    return;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        regmrk:
            if ((Reader.IsElementNil() == false)) {
                clazz.Regmrk = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regmrk")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        nr_tyyp:
            if ((Reader.IsElementNil() == false)) {
                clazz.NrTyyp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("nr_tyyp")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        regtun:
            if ((Reader.IsElementNil() == false)) {
                clazz.Regtun = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtun")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        regtun_kuup:
            if ((Reader.IsElementNil() == false)) {
                clazz.RegtunKuup = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtun_kuup")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        kehtiv:
            if ((Reader.IsElementNil() == false)) {
                clazz.Kehtiv = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kehtiv")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        regtulek:
            if ((Reader.IsElementNil() == false)) {
                clazz.Regtulek = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtulek")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        regtun_valjastaja:
            if ((Reader.IsElementNil() == false)) {
                clazz.RegtunValjastaja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtun_valjastaja")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        idkood:
            if ((Reader.IsElementNil() == false)) {
                clazz.Idkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("idkood")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        vinkood:
            if ((Reader.IsElementNil() == false)) {
                clazz.Vinkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vinkood")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        soiduki_andmed:
            if (Reader.IsElementNil()) {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>paring2_soidukiandmed>soiduki_andmed");
            }
            global::Xtee.Core.SerializationMetadata metaSoidukiAndmed = this.GetMetaData<Paring2Soidukiandmed.ISoidukiAndmedType>(Reader, ">>paring2_soidukiandmed>soiduki_andmed", "http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister");
            clazz.SoidukiAndmed = metaSoidukiAndmed.NewEntity<Paring2Soidukiandmed.ISoidukiAndmedType>();
            if ((Reader.IsEmptyElement == false)) {
                Reader.ReadStartElement("soiduki_andmed");
                metaSoidukiAndmed.NewSerializer(clazz.SoidukiAndmed).ReadXml(Reader);
                Reader.ReadEndElement();
            }
            else {
                Reader.Skip();
            }
            goto START;
        piirang:
            if ((Reader.IsElementNil() == false)) {
                clazz.Piirang = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("piirang")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        oma_andmed_v:
            if (Reader.IsElementNil()) {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>paring2_soidukiandmed>oma_andmed_v");
            }
            global::Xtee.Core.SerializationMetadata metaOmaAndmedV = this.GetMetaData<Paring2Soidukiandmed.IOmaAndmedVType>(Reader, ">>paring2_soidukiandmed>oma_andmed_v", "http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister");
            clazz.OmaAndmedV = metaOmaAndmedV.NewEntity<Paring2Soidukiandmed.IOmaAndmedVType>();
            if ((Reader.IsEmptyElement == false)) {
                Reader.ReadStartElement("oma_andmed_v");
                metaOmaAndmedV.NewSerializer(clazz.OmaAndmedV).ReadXml(Reader);
                Reader.ReadEndElement();
            }
            else {
                Reader.Skip();
            }
            goto START;
        hooldaja:
            if ((Reader.IsElementNil() == false)) {
                global::Xtee.Core.SerializationMetadata metaHooldaja = this.GetMetaData<Paring2Soidukiandmed.IHooldajaType>(Reader, ">>paring2_soidukiandmed>hooldaja", "http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister");
                clazz.Hooldaja = metaHooldaja.NewEntity<Paring2Soidukiandmed.IHooldajaType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("hooldaja");
                    metaHooldaja.NewSerializer(clazz.Hooldaja).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                Reader.Skip();
            }
            goto START;
        kasutajad:
            if ((Reader.IsElementNil() == false)) {
                clazz.Kasutajad = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kasutajad")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>paring2_soidukiandmed>soiduki_andmed", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring2Soidukiandmed.SoidukiAndmedType))]
        public class SoidukiAndmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected Paring2Soidukiandmed.ISoidukiAndmedType clazz;
            
            public SoidukiAndmedTypeSerializer(Paring2Soidukiandmed.ISoidukiAndmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("kateg");
                if (clazz.Kateg!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kateg))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kateg");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("marknm");
                if (clazz.Marknm!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Marknm))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Marknm");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mudel_mod");
                if (clazz.MudelMod!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MudelMod))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("kerenm");
                if (clazz.Kerenm!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kerenm))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mootornm");
                if (clazz.Mootornm!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mootornm))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mootmht");
                if (clazz.Mootmht!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mootmht))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mootvms");
                if (clazz.Mootvms!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mootvms))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("ehitaasta");
                if (clazz.Ehitaasta!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Ehitaasta))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("varv_nimetus");
                if (clazz.VarvNimetus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VarvNimetus))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
            START:
                if ((Reader.LocalName == "kateg")) {
                    goto kateg;
                }
                else {
                    if ((Reader.LocalName == "marknm")) {
                        goto marknm;
                    }
                    else {
                        if ((Reader.LocalName == "mudel_mod")) {
                            goto mudel_mod;
                        }
                        else {
                            if ((Reader.LocalName == "kerenm")) {
                                goto kerenm;
                            }
                            else {
                                if ((Reader.LocalName == "mootornm")) {
                                    goto mootornm;
                                }
                                else {
                                    if ((Reader.LocalName == "mootmht")) {
                                        goto mootmht;
                                    }
                                    else {
                                        if ((Reader.LocalName == "mootvms")) {
                                            goto mootvms;
                                        }
                                        else {
                                            if ((Reader.LocalName == "ehitaasta")) {
                                                goto ehitaasta;
                                            }
                                            else {
                                                if ((Reader.LocalName == "varv_nimetus")) {
                                                    goto varv_nimetus;
                                                }
                                                else {
                                                    return;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            kateg:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring2_soidukiandmed>soiduki_andmed>kateg");
                }
                clazz.Kateg = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kateg")).Value;
                goto START;
            marknm:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring2_soidukiandmed>soiduki_andmed>marknm");
                }
                clazz.Marknm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("marknm")).Value;
                goto START;
            mudel_mod:
                if ((Reader.IsElementNil() == false)) {
                    clazz.MudelMod = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mudel_mod")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            kerenm:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kerenm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kerenm")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            mootornm:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Mootornm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mootornm")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            mootmht:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Mootmht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mootmht")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            mootvms:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Mootvms = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mootvms")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            ehitaasta:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Ehitaasta = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("ehitaasta")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            varv_nimetus:
                if ((Reader.IsElementNil() == false)) {
                    clazz.VarvNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("varv_nimetus")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>paring2_soidukiandmed>oma_andmed_v", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring2Soidukiandmed.OmaAndmedVType))]
        public class OmaAndmedVTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected Paring2Soidukiandmed.IOmaAndmedVType clazz;
            
            public OmaAndmedVTypeSerializer(Paring2Soidukiandmed.IOmaAndmedVType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("oma_kood");
                if (clazz.OmaKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OmaKood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("oma_nimi");
                if (clazz.OmaNimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaNimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OmaNimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("oma_eesnimi");
                if (clazz.OmaEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaEesnimi))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("aadress");
                if (clazz.Aadress!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Aadress))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("asuk_akood");
                if (clazz.AsukAkood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AsukAkood))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("oma_muud");
                if (clazz.OmaMuud!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaMuud))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
            START:
                if ((Reader.LocalName == "oma_kood")) {
                    goto oma_kood;
                }
                else {
                    if ((Reader.LocalName == "oma_nimi")) {
                        goto oma_nimi;
                    }
                    else {
                        if ((Reader.LocalName == "oma_eesnimi")) {
                            goto oma_eesnimi;
                        }
                        else {
                            if ((Reader.LocalName == "aadress")) {
                                goto aadress;
                            }
                            else {
                                if ((Reader.LocalName == "asuk_akood")) {
                                    goto asuk_akood;
                                }
                                else {
                                    if ((Reader.LocalName == "oma_muud")) {
                                        goto oma_muud;
                                    }
                                    else {
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            oma_kood:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring2_soidukiandmed>oma_andmed_v>oma_kood");
                }
                clazz.OmaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_kood")).Value;
                goto START;
            oma_nimi:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring2_soidukiandmed>oma_andmed_v>oma_nimi");
                }
                clazz.OmaNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_nimi")).Value;
                goto START;
            oma_eesnimi:
                if ((Reader.IsElementNil() == false)) {
                    clazz.OmaEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_eesnimi")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            aadress:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Aadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("aadress")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            asuk_akood:
                if ((Reader.IsElementNil() == false)) {
                    clazz.AsukAkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("asuk_akood")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            oma_muud:
                if ((Reader.IsElementNil() == false)) {
                    clazz.OmaMuud = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_muud")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>paring2_soidukiandmed>hooldaja", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring2Soidukiandmed.HooldajaType))]
        public class HooldajaTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected Paring2Soidukiandmed.IHooldajaType clazz;
            
            public HooldajaTypeSerializer(Paring2Soidukiandmed.IHooldajaType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("ikood");
                if (clazz.Ikood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Ikood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Ikood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("nimi");
                if (clazz.Nimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Nimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Nimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("elukoht");
                if (clazz.Elukoht!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Elukoht))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("jms");
                if (clazz.Jms!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Jms))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
            START:
                if ((Reader.LocalName == "ikood")) {
                    goto ikood;
                }
                else {
                    if ((Reader.LocalName == "nimi")) {
                        goto nimi;
                    }
                    else {
                        if ((Reader.LocalName == "elukoht")) {
                            goto elukoht;
                        }
                        else {
                            if ((Reader.LocalName == "jms")) {
                                goto jms;
                            }
                            else {
                                return;
                            }
                        }
                    }
                }
            ikood:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring2_soidukiandmed>hooldaja>ikood");
                }
                clazz.Ikood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("ikood")).Value;
                goto START;
            nimi:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring2_soidukiandmed>hooldaja>nimi");
                }
                clazz.Nimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("nimi")).Value;
                goto START;
            elukoht:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Elukoht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("elukoht")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            jms:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Jms = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("jms")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            }
        }
    }
}
